/*
 Navicat Premium Data Transfer

 Source Server         : hs-main
 Source Server Type    : MySQL
 Source Server Version : 50560
 Source Host           : 120.79.13.178
 Source Database       : qqxcx_score_video

 Target Server Type    : MySQL
 Target Server Version : 50560
 File Encoding         : utf-8

 Date: 11/30/2020 14:57:04 PM
*/

SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
--  Table structure for `qqxcx_access_token`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_access_token`;
CREATE TABLE `qqxcx_access_token` (
  `token` varchar(255) NOT NULL,
  `access_token` varchar(255) DEFAULT NULL,
  `lasttime` int(11) DEFAULT NULL,
  PRIMARY KEY (`token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT;

-- ----------------------------
--  Records of `qqxcx_access_token`
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_admin`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_admin`;
CREATE TABLE `qqxcx_admin` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `username` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名',
  `password` varchar(32) NOT NULL DEFAULT '' COMMENT '密码',
  `salt` varchar(30) NOT NULL DEFAULT '' COMMENT '密码盐',
  `is_super` tinyint(1) DEFAULT '0' COMMENT '是否为超级管理员  1-是 0-否',
  `roles_id` int(11) DEFAULT '0' COMMENT '角色id',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='管理员表';

-- ----------------------------
--  Records of `qqxcx_admin`
-- ----------------------------
BEGIN;
INSERT INTO `qqxcx_admin` VALUES ('1', 'test', '2766ddb2fc34aea27a6e3f17e752776f', '5f4f7b', '1', '0');
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_banner`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_banner`;
CREATE TABLE `qqxcx_banner` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `banner_img` varchar(255) NOT NULL COMMENT '广告图片',
  `topic_id` int(11) NOT NULL DEFAULT '0' COMMENT '测评id',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT '是否删除 0-否 1-是',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COMMENT='首页广告位处理';

-- ----------------------------
--  Records of `qqxcx_banner`
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_config`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_config`;
CREATE TABLE `qqxcx_config` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `config_name` varchar(255) DEFAULT '' COMMENT '配置项名称',
  `config_value` varchar(255) DEFAULT NULL COMMENT '配置项值',
  `type` tinyint(4) DEFAULT '1' COMMENT '类型  1-输入框 2-图片上传 3-文本框',
  `config_key` varchar(255) DEFAULT NULL COMMENT '配置项key',
  `remark` varchar(50) DEFAULT NULL COMMENT '字段备注',
  `is_edit` tinyint(1) DEFAULT '1' COMMENT '是否用户编辑 1-是 0-否',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=101 DEFAULT CHARSET=utf8mb4 COMMENT='系统基础配置信息表';

-- ----------------------------
--  Records of `qqxcx_config`
-- ----------------------------
BEGIN;
INSERT INTO `qqxcx_config` VALUES  ('3', '联系我们描述', '如有什么问题，请联系我们客服解决，感谢您的使用', '3', 'wechat_desc', null, '1'), ('4', '答题对话系统头像', '/static/uploads/default/2020/08/22/5f41261fe901b.jpeg', '2', 'answer_logo', null, '1'), ('5', '客户联系电话', '13049688922', '1', 'customer_service', null, '1'), ('6', '用户每天看广告次数', '100', '1', 'user_ad_count', '请设置整数数值', '1'),  ('100', '答题对话系统头像', '/static/uploads/default/2020/08/22/5f41261fe901b.jpeg', '2', 'answer_logo', null, '1');
COMMIT;


-- ----------------------------
--  Records of `qqxcx_order_payment_log`
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_orders`
-- ----------------------------

-- ----------------------------
--  Records of `qqxcx_orders`
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_permission`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_permission`;
CREATE TABLE `qqxcx_permission` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '权限表主键',
  `parent_id` int(11) DEFAULT '0' COMMENT '父级id',
  `menu_name` varchar(50) DEFAULT '' COMMENT '菜单名称',
  `menu_action` varchar(100) DEFAULT '' COMMENT '菜单路由',
  `menu_url` varchar(255) DEFAULT NULL COMMENT '跳转连接',
  PRIMARY KEY (`id`),
  UNIQUE KEY `action_unique` (`menu_action`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4 COMMENT='后台权限表';

-- ----------------------------
--  Records of `qqxcx_permission`
-- ----------------------------
BEGIN;
INSERT INTO `qqxcx_permission` VALUES ('1', '0', '首页banner管理', 'Banner', '/admin/banner'), ('2', '0', '测评列表', 'Topic', '/admin/topic'), ('3', '0', '用户列表', 'User', '/admin/user'),  ('11', '0', '系统配置', 'Config', '/admin/config'), ('12', '0', '账号管理', 'Admin', '/admin/admin/list'), ('13', '0', '角色管理', 'Roles', '/admin/roles/list'), ('14', '0', '权限管理', 'Permission', '/admin/permission/list'), ('16', '0', '测评分类管理', 'TopicCate', '/admin/topicCate');
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_role_permission`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_role_permission`;
CREATE TABLE `qqxcx_role_permission` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '权限表主键',
  `role_id` int(11) NOT NULL COMMENT '角色名称',
  `permission_action` varchar(50) NOT NULL COMMENT '权限路由',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='后台角色-权限表';

-- ----------------------------
--  Records of `qqxcx_role_permission`
-- ----------------------------
BEGIN;
INSERT INTO `qqxcx_role_permission` VALUES ('19', '10', 'Topic'), ('20', '10', 'User'), ('21', '10', 'TtPayLog'), ('22', '10', 'Distribution'), ('23', '10', 'UserPrice'), ('24', '10', 'Config'), ('25', '10', 'Admin'), ('26', '10', 'Roles'), ('27', '10', 'Banner'), ('29', '11', 'User'), ('30', '11', 'TtPayLog'), ('31', '11', 'Distribution'), ('32', '11', 'UserPrice');
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_roles`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_roles`;
CREATE TABLE `qqxcx_roles` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '权限表主键',
  `role_name` varchar(50) NOT NULL DEFAULT '' COMMENT '角色名称',
  PRIMARY KEY (`id`),
  UNIQUE KEY `role_unique` (`role_name`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='后台角色表';

-- ----------------------------
--  Records of `qqxcx_roles`
-- ----------------------------
BEGIN;
INSERT INTO `qqxcx_roles` VALUES ('10', 'qqxcx'), ('11', '管理分佣角色');
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_topic`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_topic`;
CREATE TABLE `qqxcx_topic` (
  `topic_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `title` varchar(255) NOT NULL COMMENT '标题',
  `description` text NOT NULL COMMENT '描述',
  `category` tinyint(3) NOT NULL DEFAULT '0' COMMENT '分类',
  `banner_img` varchar(255) NOT NULL COMMENT 'banner图片',
  `topic` text NOT NULL COMMENT '题目',
  `result_type` tinyint(2) NOT NULL DEFAULT '0' COMMENT '出图方式',
  `result_img` text NOT NULL COMMENT '素材结果集合',
  `nickname_attr` varchar(255) NOT NULL COMMENT '昵称属性',
  `headerimg_attr` varchar(255) NOT NULL COMMENT '头像属性',
  `weight` int(11) NOT NULL DEFAULT '0' COMMENT '权重',
  `is_banner` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为banner  0-否 1-是',
  `is_recommend` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否为推荐 0-否 1-是',
  `icon_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '角标类型  0-无 1-hot 2-new',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否隐藏 0-否 1-是',
  `created_at` int(10) NOT NULL COMMENT '创建时间',
  `updated_at` int(10) NOT NULL COMMENT '更新时间',
  `need_share` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否需要分享才能看到结果 0-否 1-是',
  `share_content` text COMMENT '分享内容',
  `base_game_count` int(11) DEFAULT '0' COMMENT '初始在玩人数',
  `share_img` text,
  `share_shuoshuo` text,
  `weixin_need_share` tinyint(2) DEFAULT '0' COMMENT '微信端是否需要分享 0-否 1-是 2-通过激励视频',
  `qrcode_attr` varchar(255) DEFAULT NULL COMMENT '测评结果图上二维码的属性',
  `qq_qrcode` varchar(255) DEFAULT NULL COMMENT 'qq小程序二维码',
  `weixin_qrcode` varchar(255) DEFAULT NULL COMMENT '微信小程序二维码',
  `tt_need_share` tinyint(4) DEFAULT '0' COMMENT '头条端是否需要分享 0-否 1-是 2-通过激励视频 3-支付看结果',
  `tt_qrcode` varchar(255) DEFAULT NULL COMMENT '头条小程序二维码',
  `tt_play_price` decimal(5,2) DEFAULT '0.01' COMMENT '抖音端，玩测评付费价格',
  `fir_distribution` int(11) DEFAULT '0' COMMENT '一级分销返利佣金百分比',
  `sec_distribution` int(11) DEFAULT '0' COMMENT '二级分销返利佣金百分比',
  `ad_self` decimal(5,2) DEFAULT '0.00' COMMENT '看广告用户获得佣金费用',
  `ad_fir_user` decimal(5,2) DEFAULT '0.00' COMMENT '看广告一级分销用户获得佣金',
  `ad_sec_user` decimal(5,2) DEFAULT '0.00' COMMENT '看广告二级分销用户获得佣金',
  `tt_share_template_id` varchar(100) DEFAULT NULL COMMENT '字节头条分享模板id',
  `wechat_url` text COMMENT '微信视频号-公众号链接',
  `is_publish` tinyint(1) DEFAULT '0' COMMENT '是否发布 0-否 1-是',
  PRIMARY KEY (`topic_id`),
  KEY `category_index` (`category`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=92 DEFAULT CHARSET=utf8mb4 COMMENT='题型信息';

-- ----------------------------
--  Records of `qqxcx_topic`
-- ----------------------------

-- ----------------------------
--  Table structure for `qqxcx_topic_answer`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_topic_answer`;
CREATE TABLE `qqxcx_topic_answer` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `topic_id` int(11) NOT NULL COMMENT '测评id',
  `answer_img` varchar(255) NOT NULL COMMENT '答案图片',
  `created_at` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT '是否删除 0-否 1-是',
  `min_score` int(10) DEFAULT NULL COMMENT '最小分数值',
  `max_score` int(10) DEFAULT NULL COMMENT '最大分数值',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='测评答案表';

-- ----------------------------
--  Records of `qqxcx_topic_answer`
-- ----------------------------


-- ----------------------------
--  Table structure for `qqxcx_topic_cate`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_topic_cate`;
CREATE TABLE `qqxcx_topic_cate` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(10) NOT NULL COMMENT '分类名称',
  `img` varchar(255) NOT NULL COMMENT '分类图标',
  `show_index` tinyint(1) DEFAULT '0' COMMENT '首页显示 0-否 1-是',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT '是否删除 0-否 1-是',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COMMENT='测评分类管理';

-- ----------------------------
--  Records of `qqxcx_topic_cate`
-- ----------------------------

-- ----------------------------
--  Table structure for `qqxcx_topic_log`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_topic_log`;
CREATE TABLE `qqxcx_topic_log` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(11) NOT NULL COMMENT '用户id',
  `topic_id` int(11) NOT NULL COMMENT '题目id',
  `created_at` int(10) NOT NULL COMMENT '创建时间',
  `result_img` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '测评结果图片',
  `order_sn` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '支付订单编号',
  `topic_share_type` tinyint(1) DEFAULT '0' COMMENT '测评出图类型 0-直接显示  1-分享显示  2-看广告显示  3-支付显示',
  PRIMARY KEY (`id`),
  KEY `topic_id_index` (`topic_id`) USING BTREE,
  KEY `created_at_index` (`created_at`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2036 DEFAULT CHARSET=utf8mb4 COMMENT='用户-题目使用情况';

-- ----------------------------
--  Records of `qqxcx_topic_log`
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_topic_question`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_topic_question`;
CREATE TABLE `qqxcx_topic_question` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `topic_id` int(11) NOT NULL COMMENT '测评id',
  `question` varchar(255) NOT NULL COMMENT '问题标题',
  `question_options` text NOT NULL COMMENT '问题选项',
  `question_sort` smallint(6) NOT NULL DEFAULT '0' COMMENT '问题排序，越小排越前',
  `created_at` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT '是否删除 0-否 1-是',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COMMENT='测评问题表';

-- ----------------------------
--  Records of `qqxcx_topic_question`
-- ----------------------------


-- ----------------------------
--  Table structure for `qqxcx_user`
-- ----------------------------
DROP TABLE IF EXISTS `qqxcx_user`;
CREATE TABLE `qqxcx_user` (
  `user_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `openid` varchar(100) NOT NULL COMMENT '用户openid',
  `platform` tinyint(2) DEFAULT '1' COMMENT '用户来源 1-qq 2-微信',
  `avatar_url` varchar(255) DEFAULT NULL COMMENT '用户头像',
  `nickname` varchar(255) DEFAULT NULL COMMENT '用户昵称',
  `fir_distribution` int(11) DEFAULT '0' COMMENT '一级分销关联用户id',
  `money` decimal(12,2) DEFAULT '0.00' COMMENT '可提现佣金',
  `create_at` datetime DEFAULT NULL COMMENT '创建时间',
  `sec_distribution` int(11) DEFAULT '0' COMMENT '二级分销关联用户id',
  `total_money` decimal(12,2) DEFAULT '0.00' COMMENT '总佣金',
  `user_phone` char(11) DEFAULT NULL COMMENT '用户绑定手机',
  `user_password` varchar(100) DEFAULT NULL COMMENT '分销后台登陆密码',
  `user_pwd_salt` char(4) DEFAULT NULL COMMENT '密码盐',
  PRIMARY KEY (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=904 DEFAULT CHARSET=utf8mb4 COMMENT='用户信息';

-- ----------------------------
--  Records of `qqxcx_user`
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_user_distribution`
-- ----------------------------

-- ----------------------------
--  Records of `qqxcx_user_distribution`
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
--  Table structure for `qqxcx_user_price`
-- ----------------------------
